package org.zp.service;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.zp.mapper.RoleInfoMapper;
import org.zp.pojo.RoleInfo;

import com.github.pagehelper.PageHelper;

@Service
@Transactional(rollbackFor = Exception.class)//出现异常就回滚事务
public class RoleInfoServiceImpl implements RoleInfoService{
@Resource
private RoleInfoMapper r;

	@Override
	public List<RoleInfo> showRole() {
		// TODO Auto-generated method stub
		return r.showRole();
	}

	@Override
	public Integer updateState(Integer id, Integer state) {
		// TODO Auto-generated method stub
		return r.updateState(id,state);
	}

	@Override
	public RoleInfo getRoleInfoByrid(Long rid) {
		// TODO Auto-generated method stub
		return r.getRoleInfoByrid(rid);
	}

	@Override
	public List<RoleInfo> selectRole(Integer startpage, Integer limitpage, String name, String start, String end) {
		// TODO Auto-generated method stub
		PageHelper.startPage(startpage, limitpage);
		return r.selectRole(name,start,end);
	}

	@Override
	public Integer roleAdd(String roleName, int iStatus) {
		// TODO Auto-generated method stub
		return r.roleAdd(roleName,iStatus);
	}

	@Override
	public List<RoleInfo> getrolewithaccess(Long rid) {
		// TODO Auto-generated method stub
		return r.getrolewithaccess(rid);
	}

}
